Detecting an elephant flow based on the size of a packet

ABSTRACT

Some embodiments provide a forwarding element that inspects the size of each of several packets in a data flow to determine whether the data flow is an elephant flow. The forwarding element inspects the size because, in order for the packet to be of a certain size, the data flow had to already have gone through a slow start in which smaller packets are transferred and by definition be an elephant flow. When the forwarding element receives a packet in a data flow, the forwarding element identifies the size of the packet. The forwarding element then determines if the size of the packet is greater than a threshold size. If the size is greater, the forwarding element specifies that the packet&#39;s data flow is an elephant flow.

CLAIM OF BENEFIT TO PRIOR APPLICATIONS

This application claims the benefit of U.S. Provisional Patent Application 61/913,899, entitled “Detecting and Handling Elephant Flows”, filed on Dec. 9, 2013. U.S. Provisional Patent Application 61/913,899 is incorporated herein by reference.

BACKGROUND

Today, a datacenter may process different types of flows, including elephant flows and mouse flows. An elephant flow represents a long-lived flow or a continuous traffic flow that is typically associated with high volume connection. Different from an elephant flow, a mouse flow represents a short-lived flow. Mice are often associated with bursty, latency-sensitive applications, whereas elephants tend to be associated with large data transfers in which throughput is far more important than latency.

A problem with elephant flows is that they tend to fill network buffers end-to-end, and this introduces non-trivial queuing delay to anything that shares these buffers. For instance, a forwarding element may be responsible for managing several queues to forward packets, and several packets belonging to a mouse flow may be stuck in the same queue behind a group of other packets belonging to an elephant flow. In a network of elephants and mice, this means that the more latency-sensitive mice are being affected. Another problem is that mice are generally very bursty, so adaptive routing techniques are not effective with them.

BRIEF SUMMARY

Some embodiments provide a forwarding element that inspects the size of each of several packets in a data flow to determine whether the data flow is an elephant flow. The forwarding element inspects the size because, in order for the packet to be of a certain size, the data flow had to already have gone through a slow start in which smaller packets are transferred and by definition be an elephant flow. As an example, the Transmission Control Protocol (TCP) uses a slow start algorithm in order to avoid congesting the network with an inappropriately large burst of data. The TCP also uses the algorithm to slowly probe the network to determine the available capacity. The forwarding element of some embodiments takes advantage of such a slow start algorithm by using it to detect elephant flows.

When the forwarding element receives a packet in a data flow, the forwarding element identifies the size of the packet. The forwarding element then determines if the size of the packet is greater than a threshold size. If the size is greater, the forwarding element specifies that the packet's data flow is an elephant flow. If the size is not greater, the forward element processes the packet normally (e.g. forwards the packet) without any additional processing due to the size of the packet.

In some embodiments, the forwarding element does not examine the sizes of all packets but only examine the sizes of certain packets. This is because there can be many different types of packets flowing through the network, such as (Address Resolution Protocol ARP) packets, unicast flood packets, etc. The forwarding element of some embodiments selectively examines packets associated with a data flow from a network host. The forwarding element of some embodiments selectively examines packets associated with a data to a network host. In some embodiments, the forwarding element accomplishes this by looking at the sizes of packets associated with one or more flow entries in its flow table(s). In some embodiments, the forwarding element monitors the sizes of packets sent over a tunnel that is established between two network hosts.

To selectively examine certain packets, the forwarding element of some embodiments installs a flow entry with a conditional action in the flow table. Typically, an action specifies dropping the packet or outputting the packet to one or more egress ports. However, the flow's conditional action specifies that, if the packet exceeds a certain size, the packet should be sent to another component (e.g., a daemon process) of the forwarding element for further processing. The component may then identify one or more pieces of information associated with the packet that can be used to identify the elephant flow or other packets belonging to the same elephant flow.

In some embodiments, the forwarding element is a hardware-forwarding element. In some embodiments, the forwarding element is a software forwarding element. In some embodiments, the forwarding element is an edge forwarding element that is in a unique position to check the sizes of different packets before they are segmented into maximum transmission unit (MTU) sized packets by a network interface controller or card (NIC). This is important because a non-edge forwarding element that is not in such a unique position may not be able to detect elephant flows based solely on packet size. For instance, if the MTU size is less than the threshold size, then the non-edge forwarding element will not be able to use packet size to differentiate packets belonging to elephant flows from other packets belonging to mice flows.

In some embodiments, when an elephant flow is detected, the forwarding element identifies various pieces of information that can be used to identify packets belonging to the elephant flow. The forwarding element may identify tunnel information, such as the tunnel ID, the IP address of the source tunnel endpoint (e.g., the hypervisor), and the IP address of the destination tunnel endpoint. The forwarding element of some embodiments identifies the elephant flow packet's ingress port, source transport layer (e.g., UDP or TCP) port, destination transport layer port, Ethernet type, source Ethernet address, destination Ethernet address, source IP address, and/or destination IP address.

Once an elephant flow is detected, the forwarding element of some embodiments treats the detected elephant flow differently than other flows (e.g., mouse flows, non-detected elephant flows). The forwarding element may send packets associated with an elephant flow along different paths (e.g., equal-cost multipath routing (ECMP) legs) to break the elephant flow into mice flows. As another example, the forwarding element may send elephant flow traffic along a separate physical network, such as an optical network that is more suitable for slow changing, bandwidth-intensive traffic. In some embodiments, the forwarding element reports the elephant flow to a network controller (e.g., a software-defined networking controller) that can configure one or more other forwarding elements to handle the elephant flow. To notify another forwarding element, the forwarding element may mark packets associated with the detected elephant flow. When notified, the other forwarding element may perform Quality of Service (QOS) configuration to place packets belonging to the elephant flow in a particular queue that is separate from one or more other queues with other packets, break the elephant flow into mice flows, etc.

Additional techniques for detecting and handling elephant flows are described in U.S. patent application Ser. No. 14/231,647, entitled “Detecting and Handling Elephant Flows”, filed concurrently with this application, and now published as U.S. Patent Publication 2015/0163144. Some embodiments that report elephant flows to a network controller are described in U.S. patent application Ser. No. 14/231,654, entitled “Reporting Elephant Flows to a Network Controller”, filed concurrently with this application, and now published as U.S. Patent Publication 2015/0163145. These U.S. patent applications, now published respectively as U.S Patent Publications 2015/0163144 and 2015/0163145, are incorporated herein by reference. Furthermore, some embodiments provide a system that detects an elephant flow by examining the operations of a machine. In some embodiments, the machine is a physical machine or a virtual machine (VM). In detecting, the system identifies an initiation of a new data flow associated with the machine. The new data flow can be an outbound data flow or an inbound data flow. The system then determines, based on the amount of data being sent or received, if the data flow is an elephant flow.

The preceding Summary is intended to serve as a brief introduction to some embodiments as described herein. It is not meant to be an introduction or overview of all subject matter disclosed in this document. The Detailed Description that follows and the Drawings that are referred to in the Detailed Description will further describe the embodiments described in the Summary as well as other embodiments. Accordingly, to understand all the embodiments described by this document, a full review of the Summary, Detailed Description and the Drawings is needed. Moreover, the claimed subject matters are not to be limited by the illustrative details in the Summary, Detailed Description and the Drawings, but rather are to be defined by the appended claims, because the claimed subject matters can be embodied in other specific forms without departing from the spirit of the subject matters.

BRIEF DESCRIPTION OF THE DRAWINGS

The novel features of the invention are set forth in the appended claims. However, for purposes of explanation, several embodiments of the invention are set forth in the following figures.

FIG. 1 conceptually illustrates a process that some embodiments implement to detect an elephant flow by taking into account the size of a packet.

FIG. 2 conceptually illustrates an example of how the size of TCP packets can change during a TCP session.

FIG. 3 provides an illustrative example of a physical forwarding element that examines the size of a packet to determine whether the data flow associated the packet is an elephant flow.

FIG. 4 illustrates an example of how the physical forwarding element handles a packet having a size that is less than the specified size limit.

FIG. 5 shows an example of how the physical forwarding element handles a packet having a size that is greater than the specified size limit.

FIG. 6 conceptually illustrates an example of a forwarding element that is in a unique position to examine the different sizes of packets.

FIG. 7 conceptually illustrates an example logical forwarding element that uses packet size detection to monitor tunneled traffic between several associated machines.

FIG. 8 conceptually illustrates an electronic system with which some embodiments of the invention are implemented.

DETAILED DESCRIPTION

In the following detailed description of the invention, numerous details, examples, and embodiments of the invention are set forth and described. However, it will be clear and apparent to one skilled in the art that the invention is not limited to the embodiments set forth and that the invention may be practiced without some of the specific details and examples discussed.

Embodiments described herein provide a forwarding element that inspects the size of each of several packets in a data flow to determine whether the data flow is an elephant flow. The forwarding element inspects the size because, in order for the packet to be of a certain size, the data flow had to already have gone through a slow start in which smaller packets are transferred and by definition be an elephant flow. As an example, the Transmission Control Protocol (TCP) uses a slow start algorithm in order to avoid congesting the network with an inappropriately large burst of data. The TCP also uses the algorithm to slowly probe the network to determine the available capacity. The forwarding element of some embodiments takes advantage of such a slow start algorithm by using it to detect elephant flows.

FIG. 1 conceptually illustrates a process 100 that some embodiments implement to detect an elephant flow by taking into account the size of a packet. The process 100 will be described by reference to FIG. 2, which conceptually illustrates how the size of a packet in a TCP session can change over time. In some embodiments, the process 100 is performed by a forwarding element, such as a switch or a router.

The term “packet” is used here as well as throughout this application to refer to a collection of bits in a particular format sent across a network. One of ordinary skill in the art will recognize that the term “packet” may be used herein to refer to various formatted collections of bits that may be sent across a network, such as Ethernet frames, TCP segments, UDP datagrams, IP packets, etc.

As shown in FIG. 1, the process 100 begins when it receives (at 105) a packet. The process 100 then identifies (at 110) the size of the packet. At 115, the process 100 determines whether the packet size is greater than a threshold size. If the packet size is greater than the threshold size, the process 100 specifies (at 120) the data flow associated with the packet as an elephant flow. Otherwise, the process 100 proceeds to 125, which is described below.

FIG. 2 conceptually illustrates an example of how the size of TCP packets can change during a TCP session. The figure shows a graph 200. The y-axis of the graph represents time, starting with the “slow start” of the data transmission at the top. The x-axis of the graph represents the size of the packet. To simplify the description, the figure shows only several packets. The first few packets represent the start of a TCP session. The packets increase in size over time until the packet size reaches a particular size or until a loss occurs. For instance, when a loss occurs, the size of the packet may decrease rather than increase.

The show-start algorithm can begin in an exponential growth phase initially with a Congestion Window Size (CWND) of 1, 2 or 10 segments and increases it by one segment size for each new acknowledgement (ACK) that is received. If the receiver sends an ACK for every segment, this behavior effectively doubles the window size each round trip of the network. If the receiver supports delayed ACKs, the rate of increase is lower, but still increases by a minimum of one segment size each round-trip time. This behavior can continue until the congestion window size (CWND) reaches the size of the receiver's advertised window or until a loss occurs, in some embodiments.

As shown in FIG. 2, the size of the packets increases over time. At some point in time, when the size of a packet reaches a threshold value or size, the process 100 can specify that the data flow associated with the packet is an elephant flow. If the packet size does not reach the threshold value, the process 100 of some embodiments operates normally (e.g., forwarding and/or dropping packets). In other words, the process 100 of some embodiments assumes that all data flows are mice flows until there is evidence that one or more of the data flows are elephant flows.

Referring to FIG. 1, the process 100 processes (at 125) the packet. Here, the process 100 might perform typical switching operations, such as dropping or forwarding the packet. If an elephant flow has been detected, the process 100 might process the packet differently. In some embodiments, when an elephant flow is detected, the process 100 identifies various pieces of information that can be used to identify packets belonging to the elephant flow. The process 100 may identify tunnel information, such as the tunnel ID, the IP address of the source tunnel endpoint (e.g., the hypervisor), and the IP address of the destination tunnel endpoint. The process 100 of some embodiments identifies the elephant flow packet's ingress port, source transport layer (e.g., UDP or TCP) port, destination transport layer port, Ethernet type, source Ethernet address, destination Ethernet address, source IP address, and/or destination IP address.

In some embodiments, the process 100 does not examine the sizes of all packets but only examine the sizes of certain packets. This is because there can be many different types of packets flowing through the network, such as (Address Resolution Protocol ARP) packets, unicast flood packets, etc. The process 100 of some embodiments selectively examines packets associated with a set of network hosts. In some embodiments, the process 100 accomplishes this by looking at the sizes of packets associated with one or more flow entries in a set of flow table.

The process of some embodiments does not examine the sizes of all packets. In some embodiments, the process examines packets associated with a data flow from a network host. Alternatively, or conjunctively, the process of some embodiments examines packets that are destined for the network host. In other words, the process of some embodiments only examines inbound traffic to and/or outbound traffic from a network host.

To selectively examine certain packets, the process 100 of some embodiments installs a flow entry with a conditional action in the flow table. Typically, an action specifies dropping the packet or outputting the packet to one or more egress ports. However, the flow's conditional action specifies that, if the packet exceeds a certain size, the packet should be sent to another component (e.g., a daemon process) of the forwarding element for further processing. The component may then identify one or more pieces of information associated with the packet that can be used to identify the elephant flow or other packets in the same elephant flow.

Some embodiments perform variations on the process 100. The specific operations of the process 100 may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments.

In the example process of FIG. 1, the process 100 is detecting an elephant flow by keying on a large packet (e.g., TCP packet). For instance, in order for a flow's TCP window to get sufficiently large, it must get past the slow start and can therefore be considered an elephant flow. The benefit of this approach is that detecting elephants is quite cheap and can be done on a per-tunnel basis instead of a per-flow one. That is, different from examining statistics relating to flows entries (e.g., in a flow table), this approach examines tunnel traffic to detect elephants. The disadvantage of this approach is that it may potentially only work with TCP (e.g., and not UDP). Also, depending on the implementation, this approach may only be able to detect an elephant if the sender can send greater than maximum transmission unit (MTU)-sized segments.

In addition, as mentioned above, the process 100 of some embodiments is performed by a forwarding element. In some embodiments, the forwarding element is a hardware-forwarding element. The hardware forwarding element may have application-specific integrated circuits (ASICs) that are specifically designed to support in-hardware forwarding. In some embodiments, the forwarding element is a software forwarding element, such as Open vSwitch (OVS). Different from a hardware forwarding element, the software forwarding element may operate on an x86 box or a computing device (e.g., a host machine). In some embodiments, the forwarding element (e.g., software or hardware forwarding element) is a physical forwarding element that operates in conjunction with one or more other physical forwarding elements to collectively implement different logical forwarding elements (e.g., logical switches, logical routers, etc.) for different logical networks of different tenants, users, departments, etc. that use the same shared computing and networking resources. Accordingly, the term “physical forwarding element” is used herein to differentiate it from a logical forwarding element.

In some embodiments, the forwarding element is an edge forwarding element that is in a unique position to check the sizes of different packets before they are segmented into MTU-sized packets by a NIC. This is important because a non-edge forwarding element that is not in such a unique position may not be able to detect an elephant flow based solely on packet size. For instance, if the MTU size is less than the threshold size, then the non-edge forwarding element will not be able to use packet size to differentiate packets belonging to elephant flows and other packets belonging to mice flows.

Several more examples of detection and handling elephant flows will be described in detail below. Specifically, Section I describes examples of how some embodiments detect elephant flows based on packet size. This is followed by Section II, which describes an example logical forwarding element that uses packet size detection to control traffic between several associated machines. Section III then describes an example electronic system with which some embodiments of the invention are implemented.

I. Example Forwarding Element Implementation

Having described an example process, an implementation of a forwarding element that examines packet size will now be described by FIG. 3-5. FIG. 3 provides an illustrative example of a physical forwarding element 305 that examines the size of a packet to determine whether the data flow associated the packet is an elephant flow. In the example of FIG. 3, the physical forwarding element 305 is a software forwarding element (e.g., Open Virtual Switch (OVS)) with a userspace daemon 310 and a kernel module 325. However, one of ordinary skill in the art would understand that this example and other examples described herein are equally applicable to hardware forwarding elements.

As shown in FIG. 3, the kernel module 325 operates in the kernel space 350, and the userspace daemon 310 operates in the userspace 345. The kernel 350 of some embodiments provides a fast path to process incoming packets. In some embodiments, when the physical forwarding element 305 receives a packet, the kernel module 325 first checks a datapath 330 (also referred to as a datapath cache) to determine if there is a flow that matches the packet. The kernel module 325 may iterate through a number of flow entries in the datapath 330 before finding one matching entry. If there is one, the kernel module 325 processes the packet using the flow entry's associated set of actions. As an example, depending on the set of actions, the kernel module 325 might drop the packet or output the packet to one or more of the physical forwarding element's output ports.

If there is a miss in the datapath, the control is shifted from the kernel module 325 to the userspace daemon 310. In some embodiments, the control is shifted so that a translation can occur at the userspace to generate and push a flow or rule into the datapath. The userspace daemon 310 operates (e.g., as a daemon or background process) in the userspace 345 to handle such a case when there is no matching flow in the datapath 330.

The userspace daemon 310 of some embodiments installs flows in the datapath 330 following on one or more flow entries from a set of one or more flow tables 315. The set of flow tables 315 are maintained in the userspace 345 rather than the kernel space 350, in some embodiments. When there is a miss in the datapath 330, the userspace daemon 310 may install a rule in the datapath based on a flow entry from a flow table. In this manner, the physical forwarding element 305 can quickly process each subsequent packet with the same set of header values using the rule in the datapath 330. The datapath 330 provides a fast path to process incoming packets because it does not involve any translation at the userspace 345 with the userspace daemon 310.

An example of the physical forwarding element 305 installing a rule to monitor packet size will now be described by reference to the four stages 301-304 that are shown in FIG. 3. The first stage 301 illustrates the physical forwarding element 305 with no flows in the datapath 330. The datapath 330 might be empty because the physical forwarding element 305 has not received any packets, or one or more of the flows in the datapath has expired or timed out.

In the first stage 301, the physical forwarding element 305 receives a packet 335. The second stage 302 shows the physical forwarding element 305 finding no matching flow for the packet 335 in the datapath 330. In particular, the kernel module 325 has consulted the datapath to find a matching flow for the packet 335. As there is no flow in the datapath 330, the kernel module 325 has called the userspace daemon 310 to handle the miss.

In some embodiments, when there is no matching flow, the kernel module 325 sends the packet to the userspace daemon 310. The userspace daemon 310 then performs a lookup operation (e.g., a hash-based lookup) to find one or more matching flows in a set of one or more flow tables 315. If a match is found, the userspace daemon 310 sends the packet back to kernel module 325 with a set of one or more actions to perform on the packet. The userspace daemon 310 also pushes a flow to the datapath 330 to process each subsequent packet with the same set of packet header values.

In the third stage 303, the userspace daemon 325 consults one or more flow tables 315 to generate a flow 340 to store in the datapath 330. The fourth stage 304 shows the datapath 330 after the flow 340 has been stored in datapath. The flow 340 includes a set of match fields and a set of action to perform on each packet that have a set of header values that match the set of match fields. To simplify the description, the match fields are listed as, field1 through field N. Each of these fields could be a number of different fields. Examples of such fields include source MAC address, destination MAC address, source IP address, destination IP address, source port number, destination port number, the protocol in use, etc.

To examine the size of a packet, the physical forwarding element 305 of some embodiments installs a flow with a conditional action. Typically, an action specifies dropping the packet or outputting the packet to one or more ports. However, the flow 340 includes a condition action. This action specifies that, if the packet exceeds a certain size, the packet should be sent to the userspace 345 for further processing. Otherwise, if the packet does not exceed the certain size, then the packet should be output to a particular port (e.g., port 2).

In the example of FIG. 3, the condition is specifies identifying any packet that is greater than a particular size (e.g., 30 KB). The flow entry also includes a number of labels. The “userspace” label identifies that the flow entry is associated with a “userspace” action. The “Elephant” label identifies the reason why the packet has been chosen to be sent to the userspace 345. The flow entry also includes a number, which represents the port to output the packet if the packet size is not greater than the particular size. The fourth stage 304 shows the physical forwarding element 305 after installing a flow 340 in the datapath 330. Here, the kernel module continues to process the packet 335 by outputting the packet through the specified output port.

In the example described above, the physical forwarding element 305 stores a flow entry 340 with a conditional action in the datapath 330. The conditional action specifies outputting the packet to a particular port if the packet's size does not exceed a certain size. If it exceeds the certain size, the conditional action specifies sending the packet to the userspace for further processing. FIG. 4 illustrates an example of how the physical forwarding element 305 handles a packet having a size that is less than the size limit. This is followed by FIG. 5, which shows an example of how the physical forwarding element 305 handles a packet having a size that is greater than the size limit.

Three operational stages 405-415 of the physical forwarding element 305 are shown in FIG. 4. These stages 405-415 are a continuation of the ones shown in the previous figure. Here, the physical forwarding element receives another packet 420 that is associated with the same data flow in the same TCP session. Also, the size of the packet has increased from 2 KB to 16 KB. The size is still less than the size limit, which is 30 KB.

The first stage 405 shows the physical forwarding element 305 receiving the packet 420. The packet 420 is shown with its size, namely 16 KB. The packet 420 also has header values that match the match field values of the flow entry 340 in the datapath 330.

In the second stage 410, the kernel module 325 performs a lookup against one or more flows in the datapath 330 to find a matching flow. In some embodiments, the kernel module 325 parses the packet to extract or strip its header values. The kernel module then performs a hash-based lookup using the packets' the header values. As the flow entry 340 is a match, the kernel module 325 selects the flow entry in order to process the packet 420.

The third stage 415 illustrates the kernel module 325 acting as an elephant flow detector. Specifically, the kernel module 325 applies the conditional action of the flow entry 340 to the packet 420. In this stage 415, the kernel module 325 identifies the size of the packet 420 and determines that it does not exceed a threshold value (e.g., 30K). Hence, the physical forwarding element 305 processes the packet 420 normally without performing the userspace action. In other words, the physical forwarding element 305 output the packet to a specified port and does not send the packet to the userspace daemon 310 for further processing.

In the example described above, the physical forwarding element 305 determines that the size of the packet does not exceed the specified size limit. Therefore, the physical forwarding element 305 processes the packet normally without reporting it to the userspace daemon 310. FIG. 5 illustrates example operations of the physical forwarding element 305 when it identifies a subsequent packet 525 (e.g., in the same TCP session) that exceeds the specified size limit. Four operational stage 505-520 of the physical forwarding element are shown in FIG. 5.

The first stage 505 shows the physical forwarding element 305 receiving the packet 525. The packet 525 is shown with its size, namely 32 KB. The packet 525 is larger than the one shown in the previous figure. The size of the packet 525 also exceeds the specified size limit, which is 30 KB. The packet 525 has header values that match the match field values of the flow entry 340 in the datapath 330. In the second stage 510, the kernel module 325 performs a lookup against one or more flows in the datapath 330 to find a matching flow. In some embodiments, the kernel module 325 parses the packet to extract or strip its header values. The kernel module then performs a hash-based lookup using the packets' the header values. As the flow entry 340 is a match, the kernel module 325 selects the flow entry in order to process the packet 525.

The third stage 515 illustrates the kernel module 325 acting as an elephant flow detector. Specifically, the kernel module 325 applies the conditional action of the flow entry 340 to the packet 525. In this stage 515, the kernel module 325 identifies the size of the packet 420 and determines that it does exceed a threshold value (e.g., 30K). As the size limit has been reached, the physical forwarding element 305 treats the packet 525 differently than the one shown in the previous figure. Specifically, the kernel module 325 reports the elephant flow by sending the packet 525 to the userspace daemon 310. In some embodiments, the userspace daemon 310 receives the packet and stores data relating to the elephant flow. Example of such data includes header values (e.g., a group of tuples) or any other piece of data (e.g., tunnel information) that can be used to identify each packet that belongs to the elephant flow. For instance, upon receiving the packet 525, the userspace daemon 310 might store a set of header values that identifies the data flow with a marking or label that identifies or indicates that the data flow is an elephant flow.

The fourth stage 520 illustrates the physical forwarding element 525 processing the packet associated with the elephant flow. Particularly, the userspace daemon 310 of some embodiments instructs the kernel module 325 to update the flow entry 340 in the datapath 330. In some embodiments, the userspace daemon 310 generates another flow entry without the conditional action. This is shown in the fourth stage 520 with the updated flow entry 530. The match field values of the flow entry 530 remains the same as the flow entry 320. However, the conditional action has been replaced with a traditional action. This action specifies outputting any matching packet to a particular output port (e.g., port 2). In addition to updating the flow entry 340, the physical forwarding element outputs the packet 525 through a specified output port.

The physical forwarding element 305 updates the flow entry 320 in the datapath to prevent another packet associated with the same data flow from being reported as one belonging to an elephant flow. That is, the physical forwarding element 305 updates the flow entry 320 to prevent multiple reports for the same elephant flow. Another reason that the physical forwarding element updates the flow entry 320 is because of the network delay that can be introduced with the control shifting from the fast path to the userspace, and the userspace daemon performing additional operations.

In some embodiments, when an elephant is detected, the physical forwarding element 305 identifies various pieces of information that can be used to identify packets belonging to the elephant flow. The physical forwarding element may identify tunnel information, such as the tunnel ID, the IP address of the source tunnel endpoint (e.g., the hypervisor), and the IP address of the destination tunnel endpoint. The physical forwarding element of some embodiments identifies the elephant flow packet's ingress port, source transport layer (e.g., UDP or TCP) port, destination transport layer port, Ethernet type, source Ethernet address, destination Ethernet address, source IP address, and/or destination IP address.

In the example described above, the physical forwarding element installs a flow in the datapath to monitor packet size. One of ordinary skill in the art would understand that this is just one of several different ways that the physical forwarding element can examine packet size. For instance, instead of using the kernel module as an elephant detector, the physical forwarding element may include one or more separate components to determine whether the traffic being sent contains large TCP segments.

In some embodiments, the physical forwarding element 305 is an edge forward element (EFE). Different from a non-edge forwarding element (NEFE), the EFE is in a unique position to identify elephant flows. The EFE has the advance over a NEFE in that it is the last forwarding element before one or more end machines (e.g., VMs, computing device). Thus, the EFE can more easily monitor traffic coming from and going to an end machine than a NEFE. The EFE of some embodiments also has the advantage over the NEFE because the NEFE may not be able to detect an elephant flow based on the size of a packet. For instance, a NEFE may never receive large TCP packets but only receive smaller MTU-sized packets.

In some embodiments, the forwarding element is an edge forwarding element that is in a unique position to check the sizes of different packets before they are segmented into MTU-sized packets by a network interface controller or card (NIC). This is important because a non-edge forwarding element that is not in such a unique position may not be able to detect an elephant flow based solely on packet size. For instance, if the MTU size is less than the threshold size, then the non-edge forwarding element will not be able to use packet size to differentiate packets belonging to elephant flows and other packets belonging to mice flows.

FIG. 6 conceptually illustrates an example of a forwarding element that is in a unique position to examine the different sizes of packets. The figure includes the EFE 305, a virtual machine (VM) 605, and a network interface card 615 (NIC). The NIC 615 may also be referred to as a network interface controller. The VM 605 and the EFE 305 may execute on a same host device (not shown). The NIC 615 may be a physical NIC component of that that host device.

As shown in FIG. 6, the VM 605 includes an application 610 with application data 620 to send over a TCP connection to a destination machine (not shown). The VM 605 has an operating system (OS) with a TCP stack 640. The TCP stack 640 conceptually represents the OS's implementation of a number of different protocols to send and receive data through a network. The TCP stack 640 may be a part of the OS's kernel. The TCP network stack is used to process data through several different layers. For instance, when outputting data from the machine, the data may be sent to a socket buffer and processed at the TCP layer to create TCP segments or packets. Each segment is then processed by a lower layer, such as the IP layer to add an IP header. The output of the network stack is a set of packets associated with the outbound data flow. Each packet may be processed (e.g., segmented) by the machine's NIC, and sent to the EFE 305. On the other hand, when receiving data at the machine, each packet may be processed by one or more of the layers in reverse order to strip one or more headers, and place the user data or payload in an input socket buffer.

In the example of FIG. 6, the application data is processed by the OS's TCP stack to produce TCP packets 620 (i.e., TCP segments). The EFE 305 receives the TCP packets 620 before handing them off to the NIC. Prior to handing the TCP packets 620 to the NIC 615, the EFE 305 might also examine the size of the packets. For instance, the EFE 305 may detect that the size of the TCP packet has increased such that it exceeds a threshold value. The EFE 305 might then specify the data flow associated with the TCP packet as an elephant flow.

As shown, the NIC 615 receives each TCP packet from the EFE 305. The NIC 615 also segments each TCP packet into a number of maximum transmission unit (MTU)-sized packets 635. As shown, each MTU-sized packet is smaller than at least some of the larger TCP packet. The MTU may also be less than the threshold packet size that is used to determine an elephant flow. Therefore, a NEFE (not shown) that receives and forwards the MTU-sized packets 635 from the NIC 615 may not be able to use the size of each MTU-sized packet to determine that the data flow is associated with the packets is an elephant flow. Thus, the EFE 305 is in a unique position in it can see TCP packets before they are segmented into MTU-sized packets, and sent over the network through the NIC 615.

II. Logical Forwarding Element

In some embodiments, the forwarding element (e.g., software or hardware forwarding element) is a physical forwarding element that operates in conjunction with one or more other physical forwarding elements to collectively implement different logical forwarding elements (e.g., logical switches, logical routers, etc.) for different logical networks of different tenants, users, departments, etc. that use the same shared computing and networking resources.

FIG. 7 conceptually illustrates an example logical forwarding element 745 that uses packet size detection to monitor tunneled traffic between several associated machines. This figure shows a physical view 710 and a logical view 715 of the network. In the physical view 705, a network controller in a network controller cluster 725 manages and configures the physical forwarding elements 715 and 720 to implement the logical forwarding element 745.

In the example of FIG. 7, the network controller pushes management data to the physical forwarding elements 715 and 720 to establish a tunnel for the two machines 740 and 745 to communicate with one another (e.g., via a shared identifier, such as logical forwarding element identifier (LFEID), virtual network identifier, or tenant identifier). Hence, the tunnel extends the virtual network overlay between the two physical forwarding elements 715 and 720. The network controller may also push configuration data or flows (e.g., with conditional actions) to the physical forwarding elements.

As shown in the physical view 705, each physical forwarding element (715 or 720) examines the size of the packet sent from the corresponding machine (740 or 745) over the established tunnel. This is conceptually shown with a packet size checker (730 or 735) that operates on each forwarding element (715 or 720) to check the size of each packet sent from the corresponding machine (740 or 745).

The logical view 710 shows the logical forwarding element 745 that has been implemented with the instructions from the controller cluster 725. As shown, the logical forwarding element 745 performs elephant detection on each packet sent between the two machines 740 and 745. For instance, packets sent from the machine 740 to the machine 745 is examined by the size checker 730, while packets sent from the machine 745 to the machine 740 is examined by the size checker 735. Thus, the inbound and outbound traffic between these two machines 740 and 745 and are handled by the two size checkers 730 and 735.

One of the benefits of examining packet size to detect elephant flows is that it can be done without expending much computing resources. As shown in FIG. 7, another benefit of this detection approach is that it can be done on a per-tunnel basis. The disadvantage of this approach is that it may potentially only work with protocols that implement the slow start algorithm, such as TCP. In addition, depending on the network implementation, this approach may only be able to detect an elephant if the sender can send greater than maximum transmission unit MTU-sized packets.

III. Electronic System

Many of the above-described features and applications are implemented as software processes that are specified as a set of instructions recorded on a computer readable storage medium (also referred to as computer readable medium). When these instructions are executed by one or more computational or processing unit(s) (e.g., one or more processors, cores of processors, or other processing units), they cause the processing unit(s) to perform the actions indicated in the instructions. Examples of computer readable media include, but are not limited to, CD-ROMs, flash drives, random access memory (RAM) chips, hard drives, erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), etc. The computer readable media does not include carrier waves and electronic signals passing wirelessly or over wired connections.

In this specification, the term “software” is meant to include firmware residing in read-only memory or applications stored in magnetic storage, which can be read into memory for processing by a processor. Also, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while remaining distinct software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that together implement a software invention described here is within the scope of the invention. In some embodiments, the software programs, when installed to operate on one or more electronic systems, define one or more specific machine implementations that execute and perform the operations of the software programs.

FIG. 8 conceptually illustrates an electronic system 800 with which some embodiments of the invention are implemented. The electronic system 800 may be a computer (e.g., a desktop computer, personal computer, tablet computer, etc.), server, dedicated switch, phone, PDA, or any other sort of electronic or computing device. Such an electronic system includes various types of computer readable media and interfaces for various other types of computer readable media. Electronic system 800 includes a bus 805, processing unit(s) 810, a system memory 825, a read-only memory 830, a permanent storage device 835, input devices 840, and output devices 845.

The bus 805 collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system 800. For instance, the bus 805 communicatively connects the processing unit(s) 810 with the read-only memory 830, the system memory 825, and the permanent storage device 835.

From these various memory units, the processing unit(s) 810 retrieves instructions to execute and data to process in order to execute the processes of the invention. The processing unit(s) may be a single processor or a multi-core processor in different embodiments.

The read-only-memory (ROM) 830 stores static data and instructions that are needed by the processing unit(s) 810 and other modules of the electronic system. The permanent storage device 835, on the other hand, is a read-and-write memory device. This device is a non-volatile memory unit that stores instructions and data even when the electronic system 800 is off. Some embodiments of the invention use a mass-storage device (such as a magnetic or optical disk and its corresponding disk drive) as the permanent storage device 835.

Other embodiments use a removable storage device (such as a floppy disk, flash memory device, etc., and its corresponding drive) as the permanent storage device. Like the permanent storage device 835, the system memory 825 is a read-and-write memory device. However, unlike storage device 835, the system memory 825 is a volatile read-and-write memory, such a random access memory. The system memory 825 stores some of the instructions and data that the processor needs at runtime. In some embodiments, the invention's processes are stored in the system memory 825, the permanent storage device 835, and/or the read-only memory 830. From these various memory units, the processing unit(s) 810 retrieves instructions to execute and data to process in order to execute the processes of some embodiments.

The bus 805 also connects to the input and output devices 840 and 845. The input devices 840 enable the user to communicate information and select commands to the electronic system. The input devices 840 include alphanumeric keyboards and pointing devices (also called “cursor control devices”), cameras (e.g., webcams), microphones or similar devices for receiving voice commands, etc. The output devices 845 display images generated by the electronic system or otherwise output data. The output devices 845 include printers and display devices, such as cathode ray tubes (CRT) or liquid crystal displays (LCD), as well as speakers or similar audio output devices. Some embodiments include devices such as a touchscreen that function as both input and output devices.

Finally, as shown in FIG. 8, bus 805 also couples electronic system 800 to a network 865 through a network adapter (not shown). In this manner, the computer can be a part of a network of computers (such as a local area network (“LAN”), a wide area network (“WAN”), or an Intranet, or a network of networks, such as the Internet. Any or all components of electronic system 800 may be used in conjunction with the invention.

Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine-readable media, or machine-readable storage media). Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM), recordable compact discs (CD-R), rewritable compact discs (CD-RW), read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM), a variety of recordable/rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc.), flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc.), magnetic and/or solid state hard drives, read-only and recordable Blu-Ray® discs, ultra density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter.

While the above discussion primarily refers to microprocessor or multi-core processors that execute software, some embodiments are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs). In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself. In addition, some embodiments execute software stored in programmable logic devices (PLDs), ROM, or RAM devices.

As used in this specification and any claims of this application, the terms “computer”, “server”, “processor”, and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. For the purposes of the specification, the terms display or displaying means displaying on an electronic device. As used in this specification and any claims of this application, the terms “computer readable medium,” “computer readable media,” and “machine readable medium” are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral signals.

While the invention has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in other specific forms without departing from the spirit of the invention. In addition, FIG. 1 conceptually illustrates a process. As mentioned above, the specific operations of this process may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments. Furthermore, the process could be implemented using several sub-processes, or as part of a larger macro process. Thus, one of ordinary skill in the art would understand that the invention is not to be limited by the foregoing illustrative details, but rather is to be defined by the appended claims. 

What is claimed is:
 1. A non-transitory machine readable medium on which a program is stored, which when executed by at least one processing unit detects elephant flows, the program comprising sets of instructions for: receiving a packet associated with a data flow; when the size of the packet is below a threshold size, using a first flow entry to process the packet in a kernel space of the forwarding element; and when the size of the packet is over the threshold size: using the first flow entry to send the packet to a daemon; replacing the first flow entry with a second flow entry based on a response from the daemon, wherein the second flow entry processes subsequent packets of the data flow in the kernel space as packets of an elephant flow; and processing the packet based on the response from the daemon.
 2. The non-transitory machine readable medium of claim 1, wherein the packet is associated with a protocol that utilizes a slow start algorithm in which the size of each packet increases with each successful transmission until the size of the packet size reaches a particular size or until a packet loss occurs.
 3. The non-transitory machine readable medium of claim 2, wherein the protocol is Transmission Control Protocol (TCP).
 4. The non-transitory machine readable medium of claim 1, wherein the set of instructions for using the first flow entry to process the packet comprises a set of instructions for sending the packet to a first port specified in the first flow entry, and the set of instructions for processing the packet based on the response from the daemon comprises a set of instructions for sending the packet to a second port specified in the response.
 5. The non-transitory machine readable medium of claim 1, wherein the program does not examine the sizes of all packets but only examine the sizes of certain packets associated with one or more network hosts.
 6. The non-transitory machine readable medium of claim 1, wherein the flow entries are stored in a flow table cache of the forwarding element to forward packets for a network host.
 7. The non-transitory machine readable medium of claim 1, wherein the first flow entry comprises a conditional action to examine the size of the packet and the second flow entry does not include a conditional action to examine the size of the packet.
 8. The non-transitory machine medium of claim 1, wherein the program further comprises a set of instructions for sending the packet to a network interface controller (NIC), wherein the NIC receives the packet and segments the packet into a set of one or more maximum transmission unit (MTU) sized packets.
 9. The non-transitory machine readable medium of claim 8, wherein the MTU size is less than the threshold size.
 10. The non-transitory machine readable medium of claim 1, wherein the set of instructions for using the first flow entry to send the packet to the daemon comprises a set of instructions for identifying information associated with the packet in order to identify other packets in the same elephant flow.
 11. The non-transitory machine readable medium of claim 10, wherein the information includes at least one of tunnel information, an ingress port of the packet, a source transport layer protocol port number, a destination transport layer port number, an Ethernet type, a source Ethernet address, a destination Ethernet address, a source IP address, and a destination IP address.
 12. For a forwarding element, a method of detecting elephant flows, the method comprising: receiving a packet associated with a data flow; when the size of the packet is below a threshold size, using a first flow entry to process the packet in a kernel space of the forwarding element; and when the size of the packet is over the threshold size: using the first flow entry to send the packet to a daemon; replacing the first flow entry with a second flow entry based on a response from the daemon, wherein the second flow entry processes subsequent packets of the data flow in the kernel space as packets of an elephant flow; and processing the packet based on the response from the daemon.
 13. The method of claim 12, wherein the packet is associated with a protocol that utilizes a slow start algorithm in which the size of each packet increases with each successful transmission until the packet size reaches a particular size or until a packet loss occurs.
 14. The method of claim 13, wherein the protocol is Transmission Control Protocol (TCP).
 15. The method of claim 12, wherein the flow entries are stored in a flow table cache of the forwarding element to forward packets for a network host.
 16. The method of claim 15, wherein the first flow entry comprises a conditional action to examine the size of the packet and the second flow entry does not include a conditional action to examine the size of the packet.
 17. The method of claim 12 further comprising sending the packet to a network interface controller (NIC), wherein the NIC receives the packet and segments the packet into a set of one or more maximum transmission unit (MTU) sized packets.
 18. The method of claim 12, wherein using the first flow entry to send the packet to the daemon comprises identifying information associated with the packet in order to identify other packets in the same elephant flow.
 19. A network system comprising: a plurality of edge physical forwarding elements that are each directly coupled to at least one network host and configured to (i) examine packet sizes of packets from the coupled network hosts to detect elephant flows based on a threshold size for the packets, (ii) use a first flow entry to process a particular packet in a kernel space of the edge physical forwarding element when the size of the particular packet is below a threshold size, and (iii) when the particular packet is over the threshold size, use the first flow entry to send the packet to a daemon, replace the first flow entry with a second flow entry based on a response from the daemon, and process the packet based on the response from the daemon, wherein the second flow entry processes subsequent packets of the data flow in the kernel space as packets of an elephant flow; and a plurality of non-edge physical forwarding elements that are not directly coupled to any network hosts, wherein each non-edge physical forwarding element is configured to forward packets for the network hosts between edge physical forwarding elements.
 20. The network of claim 19, wherein the plurality of edge physical forwarding elements and the plurality of non-edge physical forwarding elements collectively implement a number of logical forwarding elements for different entities. 